package uit.minito.model;

import java.util.ArrayList;

import uit.minito.views.MyUtilities;
import uit.minito.views.Utility;

public class RouterModel {
	String RouterID;
	String RouterName;
	double TotalDistance;
	String NumberOfRouter;
	double TotalTimeMin;
	double TotalTImeMax;
	double WaitingTimeMin;
	double WaitingTImeMax;
	String AvaliableHours;
	int IsBargain;
	String InChargeUnit;
	
	public RouterModel(){
		
	}
	
	public RouterModel(String routerID,String routerName,double totalDistance,String numberOfRouter,
			double totalTimeMin,double totalTimeMax,double waitingTimeMin,double waitingTimeMax,
			String avaliableHors,int isBargain,String inChargeUnit) {
		RouterID = routerID;
		RouterName = routerName;
		TotalDistance = totalDistance;
		NumberOfRouter = numberOfRouter;
		TotalTimeMin = totalTimeMin;
		TotalTImeMax = totalTimeMax;
		WaitingTimeMin = waitingTimeMin;
		WaitingTImeMax = waitingTimeMax;
		AvaliableHours = avaliableHors;
		IsBargain = isBargain;
		InChargeUnit = inChargeUnit;
	}
	
	public ArrayList<String> toList(){
		ArrayList<String> resultList = new ArrayList<String>();
		resultList.add(RouterID);
		resultList.add(RouterName);
		resultList.add(String.valueOf(TotalDistance) + " km");
		
		String totalTimeString = String.valueOf((int)TotalTimeMin)+ " - "+ String.valueOf((int)TotalTImeMax) + " phút";
		if(TotalTimeMin == TotalTImeMax){
			totalTimeString = String.valueOf((int)TotalTimeMin) + " phút";
		}
		resultList.add(totalTimeString);
		resultList.add(String.valueOf(String.valueOf(MyUtilities.roundDouble(TotalDistance / (((TotalTimeMin+TotalTImeMax)/2)/60), 1) ) + " km/h"));
		
		String waitingTimeString = String.valueOf(String.valueOf((int)WaitingTimeMin)+ " - "+ String.valueOf((int)WaitingTImeMax))+ " phút";
		if(WaitingTimeMin == WaitingTImeMax){
			waitingTimeString = String.valueOf(String.valueOf((int)WaitingTimeMin))+" phút";
		}
		resultList.add(waitingTimeString);
		resultList.add(String.valueOf(NumberOfRouter));
		resultList.add(AvaliableHours);
		resultList.add(InChargeUnit);
		return resultList;
	}
	
	public String getRouterID() {
		return RouterID;
	}
	public void setRouterID(String routerID) {
		RouterID = routerID;
	}
	public String getRouterName() {
		return RouterName;
	}
	public void setRouterName(String routerName) {
		RouterName = routerName;
	}
	public double getTotalDistance() {
		return TotalDistance;
	}
	public void setTotalDistance(double totalDistance) {
		TotalDistance = totalDistance;
	}
	public String getNumberOfRouter() {
		return NumberOfRouter;
	}
	public void setNumberOfRouter(String numberOfRouter) {
		NumberOfRouter = numberOfRouter;
	}
	public double getTotalTimeMin() {
		return TotalTimeMin;
	}
	public void setTotalTimeMin(double totalTimeMin) {
		TotalTimeMin = totalTimeMin;
	}
	public double getTotalTImeMax() {
		return TotalTImeMax;
	}
	public void setTotalTImeMax(double totalTImeMax) {
		TotalTImeMax = totalTImeMax;
	}
	public double getWaitingTimeMin() {
		return WaitingTimeMin;
	}
	public void setWaitingTimeMin(double waitingTimeMin) {
		WaitingTimeMin = waitingTimeMin;
	}
	public double getWaitingTImeMax() {
		return WaitingTImeMax;
	}
	public void setWaitingTImeMax(double waitingTImeMax) {
		WaitingTImeMax = waitingTImeMax;
	}
	public String getAvaliableHours() {
		return AvaliableHours;
	}
	public void setAvaliableHours(String avaliableHours) {
		AvaliableHours = avaliableHours;
	}

	public int getIsBargain() {
		return IsBargain;
	}

	public void setIsBargain(int isBargain) {
		IsBargain = isBargain;
	}

	public String getInChargeUnit() {
		return InChargeUnit;
	}

	public void setInChargeUnit(String inChargeUnit) {
		InChargeUnit = inChargeUnit;
	}
}
